#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
#include<QMouseEvent>
#include<QWheelEvent>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    //设置鼠标允许被追踪
    setMouseTracking(true);
}

void Widget::mouseMoveEvent(QMouseEvent *event)
{
    qDebug()<<"("<<event->x()<<","<<event->y()<<")";
}

void Widget::wheelEvent(QWheelEvent *event)
{
    if(event->delta()>0)
    qDebug()<<"向前滑动："<<event->delta();
    else qDebug()<<"向后滑动："<<event->delta();
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    qDebug()<<"我很喜欢你";
}
